<template>
  <div class="info" @click="openDetail()">
    <div class="img">
      <img :src="info.image" class="bg" v-if="info.image" />
      <div class="video-btn" v-if="info.mp4_url" @click.stop="openVideo(info.mp4_url)"></div>
    </div>
    <div class="con">
      <div class="time">{{ info.add_time }}</div>
      <div class="title">{{ info.title }}</div>
      <div class="desc">{{ info.contents_html }}</div>
      <div class="btn">查看详情 <span class="icon3"></span></div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    info: Object
  },
  methods: {
    openDetail() {
      this.$router.goto({
        path: '/articleDetail',
        query: {
          id: this.info.article_id
        }
      })
    },
    openVideo(url) {
      this.eventBus.$emit('openVideo', { title: '', url: url })
    }
  }
}
</script>

<style lang="less" scoped>
.info {
  height: 295px;
  overflow: hidden;
  padding: 28px 0 0 25px;
  cursor: pointer;
  background: #fff;
  .img {
    float: left;
    width: 369px;
    height: 240px;
    position: relative;
    .bg {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .video-btn {
      width: 76px;
      height: 76px;
    }
  }
  .con {
    float: left;
    width: 825px;
    height: 240px;
    padding-left: 23px;
    position: relative;
    .time {
      color: #4d4025;
      font-size: 14px;
      line-height: 20px;
      margin: 8px 0 18px 0;
    }
    .title {
      font-size: 22px;
      height: 32px;
      line-height: 32px;
      .ellipsis();
      font-weight: 700;
      margin-bottom: 18px;
    }
    .desc {
      font-size: 16px;
      height: 52px;
      line-height: 26px;
      color: #4d4d4d;
      .ellipsis-n(2);
    }
    .btn {
      height: 32px;
      line-height: 30px;
      position: absolute;
      bottom: 13px;
      left: 20px;
      border-radius: 15px 15px 15px 15px;
      border: 1px solid #d8d8d8;
      color: #808080;
      font-size: 12px;
      padding: 0 16px;
    }
  }
}
</style>
